$(function() {
	$("#header").load('header.html', function() {loadHeader(2)});
	$("#footer").load('footer.html', function(data, status, xhr) {});
	$("#tab").load('tab.html', function(data, status, xhr) {});
    $.ajax({
        url: host + '/NPLAPI/GetALLProduct',
        type: 'POST',
        dataType: 'JSON',
        data: {
            cid: cid,
            index: 1,
            size: 10,
            uid:'admins'
        },
        success: function(res) {
            if (res.state) {
            	var obj=res.data
            	for(var i=0;i<obj.length;i++){
            		var id=obj[i].id
            		$('.onshop-list').append(
      			`
            		<li>
						<img src="${obj[i].img}" width='287' height='177'/>
						<div class="onshop-list-txt">
							<div class="onshop-goods">${obj[i].name}</div>
						<div class="onshop-address">
							<i class="iconfont icon-location"></i>
							<span>${obj[i].address}</span>
						</div>
						<div class="onshop-price">价格: <span>${obj[i].price}元</span></div>
						<div class="onshop-list-more"><a href="good-detail.html?id=${id}">查看详情</a></div>
						</div>
					</li>
            			`
            		)
}
            } else {

            }
        },
        error: function() {}
    })
})